package entidades;
import java.io.Serializable;

import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.SequenceGenerator;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;

@Entity

@NamedQueries({
@NamedQuery(name="librosFernando",query="SELECT b from Book b where b.author='Fernando'")		
})

public class Book implements Serializable{

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	private Integer id;
	
	private String title;
	private String author;	
	
	private static final long serialVersionUID = -2162460545755943930L;
	
	public Book() {
		super();
	}
	
	
	
	public Book(String title, String author) {
		super();		
		this.title = title;
		this.author = author;
	}
	
	@Override
	public String toString() {
		return "Book: " + getId();
	}
	
	public Integer getId() {
		return id;
	}
	public void setId(Integer id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	
	
}
